# Please run "combine_data.R" first, then
# proceed with this file.

# Main Paper Results ####

# Regression Analyses: Table 1

ols1a <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a, ols2a, ols3a,
                           ols3b, ols2b, ols1b),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a, ols2a, ols3a,
                        ols3b, ols2b, ols1b),
              single.row = F, 
              stars = c(.1, .05, .01),
              custom.model.names = c("Culture" , "Balanced", "Economy",
                                     "Economy", "Balanced", "Culture"),
              custom.coef.names = c(NA,
                                    "Economic Left-Right",
                                    "Cultural Left-Right"),
              reorder.coef = c(2, 3, 1),
              digits = 2,
              leading.zero = T,
              dcolumn = T)

# Figure 1a/b

df %>%
  filter(!is.na(comp_salience)) %>%
  ggplot(aes(x = lrecon_poppa,
             y = populism_poppa)) +
  geom_point(aes(shape = party_fam_3,
                 color = party_fam_3)) +
  geom_smooth(color = "steelblue", 
              fill = "steelblue",
              method = "lm",
              fullrange = TRUE,
              alpha = .1) +
  labs(y = "Populism",
       x = "Economic Left-Right") +
  facet_wrap(~ comp_salience, nrow = 1) +
  theme_bw(base_size = 10) +
  scale_shape_manual("Family", values = c(4,0,2)) +
  scale_x_continuous(limits =  c(-2.1, 2.1), breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) +
  viridis::scale_color_viridis("Family", discrete = TRUE, option = "magma", end = .6) +
  theme(legend.position = "bottom",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        strip.background = element_rect(colour = "black",
                                        fill = "white")) -> plot_a

df %>%
  filter(!is.na(comp_salience)) %>%
  ggplot(aes(x = galtan_poppa,
             y = populism_poppa)) +
  geom_point(aes(shape = party_fam_3,
                 color = party_fam_3)) +
  geom_smooth(color = "steelblue", 
              fill = "steelblue",
              method = "lm",
              fullrange = TRUE,
              alpha = .1) +
  labs(y = "Populism",
       x = "Cultural Left-Right") +
  facet_wrap(~ comp_salience, nrow = 1) +
  theme_bw(base_size = 10) +
  scale_shape_manual("Family", values = c(4,0,2)) +
  scale_x_continuous(limits =  c(-2.1, 2.1), breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) +
  viridis::scale_color_viridis("Family", discrete = TRUE, option = "magma", end = .6) +
  theme(legend.position = "bottom",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        strip.background = element_rect(colour = "black",
                                        fill = "white")) -> plot_b

ggpubr::ggarrange(plot_a,
                  plot_b,
                  ncol = 1,
                  common.legend = TRUE,
                  legend = "bottom", 
                  labels = c("A)", "B)"))

ggsave("output/Figure1.pdf",
       width = 7,
       height = 4.5)

# Appendix Section A: Comparison CHES & POPPA GALTAN ####

# Figure A1

cor.test(df$lrecon_poppa, df$lrecon_ches)
cor.test(df$galtan_poppa, df$galtan_ches)

ggplot(df, aes(x = lrecon_poppa, y = lrecon_ches)) +
  geom_point(shape = 1) +
  geom_smooth(method = "lm", color = "steelblue", fill = "steelblue") +
  ylab("Economic Left-Right (CHES)") +
  xlab("Economic Left-Right (POPPA)") +
  theme_bw(base_size = 12) +
  scale_x_continuous(breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) -> ches_poppa_econ

ggplot(df, aes(x = galtan_poppa, y = galtan_ches)) +
  geom_point(shape = 1) +
  geom_smooth(method = "lm", color = "steelblue", fill = "steelblue") +
  ylab("Cultural Left-Right (CHES)") +
  xlab("Cultural Left-Right (POPPA)") +
  theme_bw(base_size = 12)+
  scale_x_continuous(breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) -> ches_poppa_galtan

cowplot::plot_grid(ches_poppa_econ, 
                   ches_poppa_galtan, 
                   labels = c('A)', 'B)'))

ggsave(file = "output/FigureA1.pdf",
       width = 8, height = 3.5)

# Appendix Section B: CHES Data instead POPPA ####

# Table A1

ols1a_ches <- lm(populism_poppa ~ lrecon_ches, 
                 data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_ches <- lm(populism_poppa ~ galtan_ches, 
                 data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_ches <- lm(populism_poppa ~ lrecon_ches, 
                 data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_ches <- lm(populism_poppa ~ galtan_ches, 
                 data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_ches <- lm(populism_poppa ~ lrecon_ches, 
                 data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_ches <- lm(populism_poppa ~ galtan_ches, 
                 data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_ches, ols2a_ches, ols3a_ches,
                           ols3b_ches, ols2b_ches, ols1b_ches),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_ches, ols2a_ches, ols3a_ches,
                        ols3b_ches, ols2b_ches, ols1b_ches),
               single.row = F, 
               stars = c(.1, .05, .01),
               custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                      "Economy focus", "Balanced focus", "Culture focus"),
               custom.coef.names = c(NA,
                                     "Economic Left-Right",
                                     "Cultural Left-Right"),
               reorder.coef = c(2, 3, 1),
               scalebox = .75,
               digits = 2,
               leading.zero = T,
               dcolumn = T)

# Appendix Section C: Absolute Salience Approach using POPPA ####

# Table A2

ols4a <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: Low"))

ols4b <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: Medium"))

ols4c <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: High"))

ols5a <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: Low"))

ols5b <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: Medium"))

ols5c <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: High"))

texreg::screenreg(l = list(ols4a, ols4b, ols4c,
                        ols5a, ols5b, ols5c),
                  stars = c(.1, .05, .01),
               custom.model.names = c("Economy: Low", "Economy: Medium", "Economy: High",
                                      "Culture: Low", "Culture: Medium", "Culture: High"))

texreg::texreg(l = list(ols4a, ols4b, ols4c,
                        ols5a, ols5b, ols5c),
               single.row = F, 
               custom.model.names = c("Low", "Medium", "High",
                                      "Low", "Medium", "High"),
               custom.coef.names = c(NA,
                                     "Economic Left-Right",
                                     "Cultural Left-Right"),
               reorder.coef = c(2, 3, 1),
               stars = c(.1, .05, .01),
               scalebox = 1,
               digits = 2,
               leading.zero = T,
               dcolumn = T)

# Table A3

ols4d <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: Low"))

ols4e <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: Medium"))

ols4f <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, lrecon_salience3 == "Economic Salience: High"))

ols5d <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: Low"))

ols5e <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: Medium"))

ols5f <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, galtan_salience3 == "Cultural Salience: High"))

texreg::screenreg(l = list(ols4d, ols4e, ols4f,
                           ols5d, ols5e, ols5f),
                  custom.model.names = c("Economy: Low", "Economy: Medium", "Economy: High",
                                         "Culture: Low", "Culture: Medium", "Culture: High"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols4d, ols4e, ols4f,
                        ols5d, ols5e, ols5f),
               single.row = F, 
               stars = c(.1, .05, .01),
               custom.model.names = c("Low", "Medium", "High",
                                      "Low", "Medium", "High"),
               custom.coef.names = c(NA,
                                     "Cultural Left-Right",
                                     "Economic Left-Right"),
               reorder.coef = c(2, 3, 1),
               digits = 2,
               leading.zero = T,
               dcolumn = T)

# Appendix Section D: GPS Analysis ####

df_gps <- gps_prep %>%
  mutate(country_gps = countrycode::countrycode(country_gps, origin = "country.name", destination = "iso3c")) %>%
  filter(country_gps %in% unique(df$country_long)) %>%
  mutate(lrecon_salience3 = factor(ifelse(lrecon_salience_gps < quantile(lrecon_salience_gps, .33, na.rm=T), "Economic Salience: Low",
                                          ifelse(lrecon_salience_gps < quantile(lrecon_salience_gps, .66, na.rm=T), "Economic Salience: Medium",
                                                 ifelse(lrecon_salience_gps >= quantile(lrecon_salience_gps, .66, na.rm=T), "Economic Salience: High", NA))),
                                   levels = c("Economic Salience: Low", "Economic Salience: Medium", "Economic Salience: High")),
         galtan_salience3 = factor(ifelse(galtan_salience_gps < quantile(galtan_salience_gps, .33, na.rm=T), "Cultural Salience: Low",
                                          ifelse(galtan_salience_gps < quantile(galtan_salience_gps, .66, na.rm=T), "Cultural Salience: Medium",
                                                 ifelse(galtan_salience_gps >= quantile(galtan_salience_gps, .66, na.rm=T), "Cultural Salience: High", NA))),
                                   levels = c("Cultural Salience: Low", "Cultural Salience: Medium", "Cultural Salience: High")),
         lrecon_gps = (lrecon_gps - mean(lrecon_gps, na.rm = T)) / sd(lrecon_gps, na.rm = T),
         galtan_gps = (galtan_gps - mean(galtan_gps, na.rm = T)) / sd(galtan_gps, na.rm = T),
         diff_salience = lrecon_salience_gps - galtan_salience_gps,
         comp_salience = factor(cut(diff_salience,
                                    quantile(diff_salience, 
                                             seq(0, 1, length.out = 4), 
                                             na.rm = T)),
                                label = c("Salience:\nCulture focus",
                                          "Salience:\nBalanced focus",
                                          "Salience:\nEconomic focus")),
         lrecon_salience3 = factor(ifelse(lrecon_salience_gps < quantile(lrecon_salience_gps, .33, na.rm=T), "Economic Salience: Low",
                                          ifelse(lrecon_salience_gps < quantile(lrecon_salience_gps, .66, na.rm=T), "Economic Salience: Medium",
                                                 ifelse(lrecon_salience_gps >= quantile(lrecon_salience_gps, .66, na.rm=T), "Economic Salience: High", NA))),
                                   levels = c("Economic Salience: Low", "Economic Salience: Medium", "Economic Salience: High")),
         galtan_salience3 = factor(ifelse(galtan_salience_gps < quantile(galtan_salience_gps, .33, na.rm=T), "Cultural Salience: Low",
                                          ifelse(galtan_salience_gps < quantile(galtan_salience_gps, .66, na.rm=T), "Cultural Salience: Medium",
                                                 ifelse(galtan_salience_gps >= quantile(galtan_salience_gps, .66, na.rm=T), "Cultural Salience: High", NA))),
                                   levels = c("Cultural Salience: Low", "Cultural Salience: Medium", "Cultural Salience: High")))

# Table A4

ols1a_gps <- lm(populism_gps ~ lrecon_gps, 
                data = filter(df_gps, comp_salience == "Salience:\nCulture focus"))

ols1b_gps <- lm(populism_gps ~ galtan_gps, 
            data = filter(df_gps, comp_salience == "Salience:\nCulture focus"))

ols2a_gps <- lm(populism_gps ~ lrecon_gps, 
            data = filter(df_gps, comp_salience == "Salience:\nBalanced focus"))

ols2b_gps <- lm(populism_gps ~ galtan_gps, 
            data = filter(df_gps, comp_salience == "Salience:\nBalanced focus"))

ols3a_gps <- lm(populism_gps ~ lrecon_gps, 
            data = filter(df_gps, comp_salience == "Salience:\nEconomic focus"))

ols3b_gps <- lm(populism_gps ~ galtan_gps , 
            data = filter(df_gps, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l= list(ols1a_gps, ols2a_gps, ols3a_gps,
                          ols3b_gps, ols2b_gps, ols1b_gps),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))
               

texreg::texreg(l= list(ols1a_gps, ols2a_gps, ols3a_gps,
                       ols3b_gps, ols2b_gps, ols1b_gps),
               single.row = F,
               stars = c(.1, .05, .01),
               custom.model.names = c("Culture" , "Balanced", "Economy",
                                      "Economy", "Balanced", "Culture"),
               custom.coef.names = c(NA,
                                     "Economic Left-Right",
                                     "Cultural Left-Right"),
               reorder.coef = c(2, 3, 1),
               scalebox = .75,
               digits = 2,
               dcolumn = T)




# Appendix Section E: Alternative Cutoffs ####

df_bw <- data.frame(c = as.numeric(),
                    s = as.numeric(),
                    i = as.numeric(),
                    v = as.character(),
                    m = as.character())

for (i in seq(from = 0.5, to = 3, by = .5)){
  
  df_temp <- df %>%
    mutate(comp_salience = ifelse(diff_salience < i*-1, "Salience:\nCulture focus",
                                  ifelse(diff_salience > i, "Salience:\nEconomic focus", "Salience:\nBalanced focus")))
    
  ols1a_temp <- lm(populism_poppa ~ lrecon_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nCulture focus"))
  
  ols1b_temp <- lm(populism_poppa ~ galtan_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nCulture focus"))
  
  ols2a_temp <- lm(populism_poppa ~ lrecon_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nBalanced focus"))
  
  ols2b_temp <- lm(populism_poppa ~ galtan_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nBalanced focus"))
  
  ols3a_temp <- lm(populism_poppa ~ lrecon_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nEconomic focus"))
  
  ols3b_temp <- lm(populism_poppa ~ galtan_poppa, 
                   data = filter(df_temp, comp_salience == "Salience:\nEconomic focus"))
  
  out_temp <- data.frame(c = c(summary(ols1a_temp)$coefficients[2,1], summary(ols2a_temp)$coefficients[2,1], summary(ols3a_temp)$coefficients[2,1],
                               summary(ols1b_temp)$coefficients[2,1], summary(ols2b_temp)$coefficients[2,1], summary(ols3b_temp)$coefficients[2,1]),
                         s = c(summary(ols1a_temp)$coefficients[2,2], summary(ols2a_temp)$coefficients[2,2], summary(ols3a_temp)$coefficients[2,2],
                               summary(ols1b_temp)$coefficients[2,2], summary(ols2b_temp)$coefficients[2,2], summary(ols3b_temp)$coefficients[2,2]),
                         i = rep(i, 6),
                         v = rep(c("Economic Left-Right", "Cultural Left-Right"), each = 3),
                         m = rep(c("Salience:\nCulture focus", "Salience:\nBalanced focus", "Salience:\nEconomic focus"), 2))
                         
  df_bw <- rbind(df_bw, out_temp)
  
}

# Figure A2

df_bw %>%
  mutate(lower = c - 1.96*s,
         upper = c + 1.96*s,
         m = factor(m, 
                    levels = c("Salience:\nCulture focus", "Salience:\nBalanced focus", "Salience:\nEconomic focus"))) %>%
  ggplot(., aes(x = i, y = c, colour = v, shape = v)) +
  geom_pointrange(aes(ymin = lower, ymax = upper), position = position_dodge(width = 0.35)) +
  geom_hline(yintercept = 0, lty = "dotted") +
  theme_minimal() +
  facet_grid(m~.) + 
  scale_colour_discrete("Left-Right:") + 
  scale_shape_discrete("Left-Right:") +
  theme(legend.position = "bottom") +
  labs(x = "Bandwidth", y = "Coefficient") +
  NULL

ggsave("output/FigureA2.pdf",
       width = 7,
       height = 4.5)

# Appendix Section F: Density of Salience ####

# Figure A3

ggplot(df, aes(x = diff_salience, y = 0, 
               fill = factor(stat(quantile)))) +
  ggridges::stat_density_ridges(
    geom = "density_ridges_gradient", calc_ecdf = TRUE,
    quantiles = 3, quantile_lines = TRUE
  ) +
  theme_bw(base_size = 12) +
  theme(legend.position = "bottom") +
  scale_fill_brewer("Dimension Emphasis", labels = c("Culture",
                                                     "Balance",
                                                     "Economy")) +
  ylab("Density") +
  xlab("Economic - Cultural Salience")

ggsave(file = "output/FigureA3.pdf", 
       width = 10, 
       height = 5)

# Appendix Section G: Excl. RR & RL ####

# Table A5 (NO RR)

ols1a_norr <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus" & party_fam_3 != "Radical Right"))

ols1b_norr <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus" & party_fam_3 != "Radical Right"))

ols2a_norr <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus" & party_fam_3 != "Radical Right"))

ols2b_norr <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus" & party_fam_3 != "Radical Right"))

ols3a_norr <- lm(populism_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus" & party_fam_3 != "Radical Right"))

ols3b_norr <- lm(populism_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus" & party_fam_3 != "Radical Right"))

texreg::screenreg(l = list(ols1a_norr, ols2a_norr, ols3a_norr,
                           ols3b_norr, ols2b_norr, ols1b_norr),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_norr, ols2a_norr, ols3a_norr,
                           ols3b_norr, ols2b_norr, ols1b_norr),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A6 (NO RL)

ols1a_norl <- lm(populism_poppa ~ lrecon_poppa, 
                 data = filter(df, comp_salience == "Salience:\nCulture focus" & party_fam_3 != "Radical Left"))

ols1b_norl <- lm(populism_poppa ~ galtan_poppa, 
                 data = filter(df, comp_salience == "Salience:\nCulture focus" & party_fam_3 != "Radical Left"))

ols2a_norl <- lm(populism_poppa ~ lrecon_poppa, 
                 data = filter(df, comp_salience == "Salience:\nBalanced focus" & party_fam_3 != "Radical Left"))

ols2b_norl <- lm(populism_poppa ~ galtan_poppa, 
                 data = filter(df, comp_salience == "Salience:\nBalanced focus" & party_fam_3 != "Radical Left"))

ols3a_norl <- lm(populism_poppa ~ lrecon_poppa, 
                 data = filter(df, comp_salience == "Salience:\nEconomic focus" & party_fam_3 != "Radical Left"))

ols3b_norl <- lm(populism_poppa ~ galtan_poppa, 
                 data = filter(df, comp_salience == "Salience:\nEconomic focus" & party_fam_3 != "Radical Left"))

texreg::screenreg(l = list(ols1a_norl, ols2a_norl, ols3a_norl,
                           ols3b_norl, ols2b_norl, ols1b_norl),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_norl, ols2a_norl, ols3a_norl,
                           ols3b_norl, ols2b_norl, ols1b_norl),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Appendix Section H: Subdims GALTAN ####

# Table A8

ols1b_imm <- lm(populism_poppa ~ immigration_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2b_imm <- lm(populism_poppa ~ immigration_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3b_imm <- lm(populism_poppa ~ immigration_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols3b_imm, ols2b_imm, ols1b_imm),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols3b_imm, ols2b_imm, ols1b_imm),
               custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
               stars = c(.1, .05, .01))

# Table A9

ols1b_nat <- lm(populism_poppa ~ nativism_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2b_nat <- lm(populism_poppa ~ nativism_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3b_nat <- lm(populism_poppa ~ nativism_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols3b_nat, ols2b_nat, ols1b_nat),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols3b_nat, ols2b_nat, ols1b_nat),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A10

ols1b_law <- lm(populism_poppa ~ laworder_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2b_law <- lm(populism_poppa ~ laworder_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3b_law <- lm(populism_poppa ~ laworder_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols3b_law, ols2b_law, ols1b_law),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols3b_law, ols2b_law, ols1b_law),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A11

ols1b_lif<- lm(populism_poppa ~ lifestyle_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2b_lif <- lm(populism_poppa ~ lifestyle_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3b_lif <- lm(populism_poppa ~ lifestyle_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols3b_lif, ols2b_lif, ols1b_lif),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols3b_lif, ols2b_lif, ols1b_lif),
                  custom.model.names = c("Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Appendix Section I: Subdimensions of Populism ####

# Table A12

ols1a_man <- lm(manichean_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_man <- lm(manichean_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_man <- lm(manichean_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_man <- lm(manichean_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_man <- lm(manichean_poppa ~ lrecon_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_man <- lm(manichean_poppa ~ galtan_poppa, 
            data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_man, ols2a_man, ols3a_man,
                           ols3b_man, ols2b_man, ols1b_man),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))


texreg::texreg(l = list(ols1a_man, ols2a_man, ols3a_man,
                           ols3b_man, ols2b_man, ols1b_man),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A13

ols1a_ind <- lm(indivisble_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_ind <- lm(indivisble_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_ind <- lm(indivisble_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_ind <- lm(indivisble_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_ind <- lm(indivisble_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_ind <- lm(indivisble_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_ind, ols2a_ind, ols3a_ind,
                           ols3b_ind, ols2b_ind, ols1b_ind),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_ind, ols2a_ind, ols3a_ind,
                           ols3b_ind, ols2b_ind, ols1b_ind),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A14

ols1a_gen <- lm(generalwill_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_gen <- lm(generalwill_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_gen <- lm(generalwill_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_gen <- lm(generalwill_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_gen <- lm(generalwill_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_gen <- lm(generalwill_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_gen, ols2a_gen, ols3a_gen,
                           ols3b_gen, ols2b_gen, ols1b_gen),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_gen, ols2a_gen, ols3a_gen,
                           ols3b_gen, ols2b_gen, ols1b_gen),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A15

ols1a_peo <- lm(peoplecentrism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_peo <- lm(peoplecentrism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_peo <- lm(peoplecentrism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_peo <- lm(peoplecentrism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_peo <- lm(peoplecentrism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_peo <- lm(peoplecentrism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_peo, ols2a_peo, ols3a_peo,
                           ols3b_peo, ols2b_peo, ols1b_peo),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

texreg::texreg(l = list(ols1a_peo, ols2a_peo, ols3a_peo,
                           ols3b_peo, ols2b_peo, ols1b_peo),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Table A16

ols1a_ant <- lm(antielitism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols1b_ant <- lm(antielitism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nCulture focus"))

ols2a_ant <- lm(antielitism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols2b_ant <- lm(antielitism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nBalanced focus"))

ols3a_ant <- lm(antielitism_poppa ~ lrecon_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

ols3b_ant <- lm(antielitism_poppa ~ galtan_poppa, 
                data = filter(df, comp_salience == "Salience:\nEconomic focus"))

texreg::screenreg(l = list(ols1a_ant, ols2a_ant, ols3a_ant,
                           ols3b_ant, ols2b_ant, ols1b_ant),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))


texreg::texreg(l = list(ols1a_ant, ols2a_ant, ols3a_ant,
                           ols3b_ant, ols2b_ant, ols1b_ant),
                  custom.model.names = c("Culture focus", "Balanced focus", "Economy focus",
                                         "Economy focus", "Balanced focus", "Culture focus"),
                  stars = c(.1, .05, .01))

# Appendix Section J: Large Figures with Party Labels ####

# Figure A4

df %>%
  filter(!is.na(comp_salience)) %>%
  ggplot(aes(x = lrecon_poppa,
             y = populism_poppa,
             label = partyname_poppa)) +
  geom_text(aes(color = party_fam_3)) + 
  geom_smooth(color = "steelblue", 
              fill = "steelblue",
              method = "lm",
              fullrange = TRUE,
              alpha = .1) +
  labs(y = "Populism",
       x = "Economic Left-Right") +
  facet_wrap(~ comp_salience, nrow = 3) +
  theme_bw(base_size = 10) +
  scale_x_continuous(limits =  c(-2.1, 2.1), breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) +
  viridis::scale_color_viridis("Family", discrete = TRUE, option = "magma", end = .6) +
  theme(legend.position = "bottom",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        strip.background = element_rect(colour = "black",
                                        fill = "white"))

ggsave("./output/FigureA4.pdf",
       width = 7,
       height = 9)

# Figure A5

df %>%
  filter(!is.na(comp_salience)) %>%
  ggplot(aes(x = galtan_poppa,
             y = populism_poppa,
             label = partyname_poppa)) +
  geom_text(aes(color = party_fam_3)) + 
  geom_smooth(color = "steelblue", 
              fill = "steelblue",
              method = "lm",
              fullrange = TRUE,
              alpha = .1) +
  labs(y = "Populism",
       x = "Cultural Left-Right") +
  facet_wrap(~ comp_salience, nrow = 3) +
  theme_bw(base_size = 10) +
  scale_x_continuous(limits =  c(-2.1, 2.1), breaks = seq(-2,2,1), labels = c("-2SD", "-1SD", "Mean", "+1SD", "+2SD")) +
  viridis::scale_color_viridis("Family", discrete = TRUE, option = "magma", end = .6) +
  theme(legend.position = "bottom",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        strip.background = element_rect(colour = "black",
                                        fill = "white"))

ggsave("./output/FigureA5.pdf",
       width = 7,
       height = 9)
